﻿using AutoMapper;
using Domain;
using RBAC.API.Command.Permission;
using RBAC.API.Command.Role;
using RBAC.API.Command.User;
using RBAC.API.DTOs;
using RBAC.API.Handler.User;

namespace RBAC.API
{
    public class AutomapperFiles:Profile
    {
        /// <summary>
        /// 指定映射关系
        /// </summary>
        public AutomapperFiles()
        {
            //用户显示
            CreateMap<UserModel, UserDTO>();
            //用户添加
            CreateMap<UserAddCommand, UserModel>();      
            //用户信息修改
            CreateMap<UserUpdateCommand, UserModel>();
            //角色显示
            CreateMap<RoleModel,RoleDTO>();
            //角色添加
            CreateMap<RoleAddCommand, RoleModel>();
            //角色修改
            CreateMap<RoleUpdateCommand, RoleModel>();
            //权限显示
            CreateMap<PermissionModel, PermissionDTO>();
            //权限添加
            CreateMap<PermissionAddCommand, PermissionModel>();
            //权限修改
            CreateMap<PermissionUpdateCommand, PermissionModel>();
        }
    }
}
